package cn.t.service.device;

import cn.t.constants.CommonConstants;
import cn.t.core.service.ServiceImpl;
import cn.t.model.device.DeviceConfigRowDO;
import cn.t.repository.device.DeviceConfigRowRepository;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 配置行领域服务
 */
@Slf4j
@Service
@AllArgsConstructor
public class DeviceConfigRowService extends ServiceImpl<DeviceConfigRowDO, DeviceConfigRowRepository> {

    public List<DeviceConfigRowDO> getConfigRows(Long configId) {
        DeviceConfigRowDO queryParams = new DeviceConfigRowDO();
        queryParams.setConfigId(configId);
        return this.findByModel(queryParams, CommonConstants.ZERO, Integer.MAX_VALUE, null, null);
    }

    public boolean removeByConfigId(Long configId) {
        return this.repository.removeByConfigId(configId);
    }

    public boolean addBatch(List<DeviceConfigRowDO> deviceConfigRowDOS) {
        return this.repository.addBatch(deviceConfigRowDOS);
    }

}
